<!-- 设置面包屑 -->
#set($breadcrumbs = [{"name":"分支机构","url":"$!{base}/contract/list"},{"name":"合同列表"}])
<!-- 设置功能描述 -->
#set($feature = {"major":"分支机构","minor":"合同列表"})
<!-- 设置导航高亮 -->
#set($subList = "contract_list")
<table class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<th colspan="7"> 
				<div class="row">
					<div class="col-md-3 ">
						<form action="$!{base}/contract/search" method="post" class="search-form">
							<div class="input-group">
								<span class="input-group-addon"> 关键词 </span> <input class="form-control search-query" type="text" name="key" value="$!{obj.data.key}" data-type="reg" data-reg="/^[\u4e00-\u9fa5\d\w]{1,}$/"
									data-default="Search..." data-error="请输入搜索关键词" placeholder="请输入合同(编码)检索"> <span class="input-group-addon btn-purple search-btn" id="queryInfo"
									style="cursor:pointer ;"> <i class="fa fa-search"></i> GO
								</span>
							</div>
						</form>
					</div>
					<div class="col-md-2 col-md-offset-7">
						<button class="btn btn-sm btn-primary pull-right btn-pop" data-url='/contract/add' data-width='457' data-height='370' data-title='添加合同' data-btn='false'
							style="margin-right:45px">
							<i class="fa fa-plus"></i> 添加合同
						</button>
					</div>
				</div>
			</th>
		</tr>
		<tr class="center">
			<th>序号</th>
			<th>合同编码</th>
			<th>合同名称</th>
			<th>合同负责人</th>
			<th>合同所属项目</th>
			<th>合同签订时间</th>
			<th>操作</th>
		</tr>
	</thead>

	<tbody>
		#foreach($contract in $obj.data.pager.entities )
		<tr>
			<td class="center">$!{contract.id}</td>
			<td>$!{contract.c_code}</td>
			<td>$!{contract.c_name}</td>
			<td>$!{contract.u_real_name}</td> 
			<td>$!{contract.p_name}</td> 
			<td> $!date.format('yyyy-MM-dd HH:mm:ss' , $!contract.c_sign_time) </td> 
			<td class="center">
				<div class="hidden-sm hidden-xs btn-group">

					<button class="btn btn-xs btn-info btn-pop" data-url='/contract/edit/$!{contract.id}' data-width='425' data-height='370' data-title='编辑机构 $!{contract.realName} 资料' data-btn='false'>
						<i class="ace-icon fa fa-pencil bigger-120"></i>编辑
					</button>

					<button class="btn btn-xs btn-danger btn-delete" data-url='/contract/delete' data-id='$!{contract.id}'>
						<i class="ace-icon fa fa-trash-o bigger-120"></i>删除
					</button>
				</div>
			</td>
		</tr>
		#end
	</tbody>
	<tfoot>
		#if(${obj.data.pager.count} == 0)
		<tr>
			<td colspan="7" class="null-pager">没有符合条件的数据</td>
		</tr>
		#else
		<tr>
			<td colspan="7">
				<div class="pull-right">$!{obj.data.pager.pagerBar}</div>
			</td>
		</tr>
		#end
	</tfoot>
</table>
<script type="text/javascript">
	function activeUser(id, flag) {
		$.post(getRootPath() + "/user/toggleStatus", {
			id : id,
			status : flag ? 'ACTIVED' : 'DISABLED'
		}, function(result) {
			if (result.operationState == 'SUCCESS') {
				refresh();
			} else {
				showMessage(result.data.reason);
			}
		}, 'json');
	}
</script>